Skip to content

Conversation

mkantor
Copy link
Contributor

@mkantor mkantor commented Aug 1, 2025

#43526 implemented limited support for completions within type arguments, but only for type arguments of types (not values like generic function calls), and only for specific locations within the type literal (e.g. property names of object types). This pull request generalizes type argument completions such that suggestions now appear in many more scenarios, including:

  • Type arguments of expressions:
    • function calls (f<…>())
    • new expressions (new Foo<…>())
    • tagged templates (tag<…>`blah`)
    • JSX elements (<Component<…>/>)
    • decorators (@decorator<…> class {})
    • instantiation expressions (f<…>)
  • Types of property values within type arguments (Foo<{ x: … }>)
  • String literal types (Foo<"…">)
  • Tuple types (Foo<[…]>)

Suggested completions are derived from the relevant type parameter's constraint.

This pull request subsumes #61758 and includes the additional enhancements mentioned in that pull request's description.

Fixes #61751.
Fixes #56299.
Fixes #52898.
Fixes #34771.

@i-ayushh18
Copy link

🤖 AI Assistant: Task completed: PR #62170: Enhance type argument completions

URL: #6217...

1 similar comment
@i-ayushh18
Copy link

🤖 AI Assistant: Task completed: PR #62170: Enhance type argument completions

URL: #6217...

@mkantor
Copy link
Contributor Author

mkantor commented Aug 4, 2025

@i-ayushh18 I don't know if this is intentional, but it seems that you have a bot which is spamming a bunch of nonsense comments across many pull requests. If it is intentional, please cut it out.

@i-ayushh18
Copy link

@i-ayushh18 I don't know if this is intentional, but it seems that you have a bot which is spamming a bunch of nonsense comments across many pull requests. If it is intentional, please cut it out.

Sorry for the thing,a bot was responsible for that,will suspend that at latest!

@edperetokin
Copy link

I have tested this changes locally, and it works well for me.

Looking forward to seeing it merged and released soon.

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Aug 13, 2025
Previously, `getTypeArgumentConstraint` could only find constraints for
type arguments of generic type instantiations. Now it additionally
supports type arguments of the following expression kinds:

- function calls
- `new` expressions
- tagged templates
- JSX expressions
- decorators
- instantiation expressions
@mkantor mkantor force-pushed the type-argument-completions branch from e8f8ef9 to d3e5ece Compare September 5, 2025 15:43
@jakebailey
Copy link
Member

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 8, 2025

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
pack this ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 8, 2025

Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/166007/artifacts?artifactName=tgz&fileId=408A29254ED740790FC36224712B5EECC5FE4E3336E5E99904E2F4F26D2F388802&fileName=/typescript-6.0.0-insiders.20250908.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I'm concerned, this seems fine to me.

@github-project-automation github-project-automation bot moved this from Not started to Needs merge in PR Backlog Sep 30, 2025
@jakebailey jakebailey merged commit d4b15eb into microsoft:main Sep 30, 2025
33 checks passed
@github-project-automation github-project-automation bot moved this from Needs merge to Done in PR Backlog Sep 30, 2025
@mkantor
Copy link
Contributor Author

mkantor commented Sep 30, 2025

Thanks for reviewing/merging!

@mkantor mkantor deleted the type-argument-completions branch September 30, 2025 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Status: Done
5 participants